package com.example.baiduweishi.activities;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.example.baiduweishi.R;
import com.example.baiduweishi.activities.base.BaseActivity;
import com.example.baiduweishi.fragments.FirstFraqment;
import com.example.baiduweishi.fragments.SecondFragment;

import butterknife.BindView;

public class OneKeySOSActivity extends BaseActivity {
    FirstFraqment firstFraqment;
    @BindView(R.id.toolbar_sos)
    Toolbar toolbarSos;
    @BindView(R.id.fl_sos)
    FrameLayout flSos;
    @BindView(R.id.activity_one_key_sos)
    LinearLayout activityOneKeySos;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public int getContentXML() {
        return R.layout.activity_one_key_sos;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        setSupportActionBar(toolbarSos);
        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        //加载fragment
        if (firstFraqment == null) {
            firstFraqment = new FirstFraqment();
        }
        getFragmentManager().beginTransaction().replace(R.id.fl_sos, firstFraqment).commit();
    }

    public void toSecondFragment() {
        getFragmentManager().beginTransaction().hide(firstFraqment).add(R.id.fl_sos, new SecondFragment()).commit();
    }

}
